{% extends "base_table.html" %}

{% block structure_tab_class %} active{% endblock %}

{% block inner_content %}
<h3>重命名列</h3>
<form action="{{ url_for('rename_column', table=table) }}" class="form" method="post">
  <div class="form-group">
    <label for="id_rename">列名称</label>
    <select class="form-control" id="id_rename" name="rename">
      <option value="">选择列</option>
      {% for column in columns %}
        <option {% if column.name == rename %}selected="selected" {% endif %}value="{{ column.name }}">{{ column.name }} ({{ column.data_type }})</option>
      {% endfor %}
    </select>
  </div>
  <div class="form-group">
    <label for="id_rename_to">重命名为</label>
    <input class="form-control" id="id_rename_to" name="rename_to" value="{% if rename_to %}{{ rename_to }}{% endif %}" />
    <span class="help-block">
      注意：新名称不能与任何现有列名称冲突！
    </span>
  </div>
  <button class="btn btn-success" type="submit">重命名列</button>
  <a class="btn btn-secondary" href="{{ url_for('table_structure', table=table) }}">取消</a>
</form>
{% endblock %}
